package pt.nmfa.peste.session;

import pt.nmfa.peste.entity.*;
import java.util.ArrayList;
import java.util.List;
import org.jboss.seam.annotations.Name;
import org.jboss.seam.framework.EntityHome;

@Name("channelsHome")
public class ChannelsHome extends EntityHome<Channels> {

	public void setChannelsEpgPos(String id) {
		setId(id);
	}

	public String getChannelsEpgPos() {
		return (String) getId();
	}

	@Override
	protected Channels createInstance() {
		Channels channels = new Channels();
		return channels;
	}

	public void load() {
		if (isIdDefined()) {
			wire();
		}
	}

	public void wire() {
		getInstance();
	}

	public boolean isWired() {
		return true;
	}

	public Channels getDefinedInstance() {
		return isIdDefined() ? getInstance() : null;
	}

	public List<TvProgram> getTvPrograms() {
		return getInstance() == null ? null : new ArrayList<TvProgram>(
				getInstance().getTvPrograms());
	}

	public List<ChannelsCategory> getChannelsCategories() {
		return getInstance() == null ? null : new ArrayList<ChannelsCategory>(
				getInstance().getChannelsCategories());
	}

}
